 import baseurl from './config.js'
// 公共的请求
 const request = function(options) {
	 console.log(options)
     options.url = baseurl + options.url;
     try {
       const token = uni.getStorageSync('token');
	   console.log(token)
       // const username = uni.getStorageSync('username');
       // debugger
       if (token) {
         options.header = {
           'token' :   token
         };
        }else{
            uni.navigateTo({
                url: './pages/login/login' 
            });
            return;
        }
     } catch (err) {
      console.log(err)
    }
    return uni.request(options);
  }
export default request;